import { request } from "@umijs/max";;
import { UMS_REQUEST_PREFIX } from "@/utils/config";
import { companyTypes, pagination } from "@/constants/types";

// 客户列表
/**
 * 获取客户列表
 * @returns 
 */
export async function fetchCompanyList(params: pagination) {
  return request(`${UMS_REQUEST_PREFIX}/crm/customer/list`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 获取客户详情
 * @returns 
 */
export async function fetchCompanyDetail(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/crm/customer/detail`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 添加客户
 * @returns 
 */
export async function addCompany(params: companyTypes) {
  return request(`${UMS_REQUEST_PREFIX}/crm/customer/add`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 修改客户
 * @returns 
 */
export async function updateCompany(params: companyTypes) {
  return request(`${UMS_REQUEST_PREFIX}/crm/customer/update`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 上传合同
 * @returns 
 */
export async function uploadContract(params: companyTypes) {
  return request(`${UMS_REQUEST_PREFIX}/crm/customer/uploadContract`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 开始合作
 * @returns 
 */
export async function startCooperation(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/crm/customer/startCooperation`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 取消合作
 * @returns 
 */
export async function cancelCooperation(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/crm/customer/cancelCooperation`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 取消合作
 * @returns 
 */
export async function restartCooperation(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/crm/customer/restartCooperation`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 下单手机列表
 * @returns 
 */
export async function fetchStaffsList(params: companyTypes) {
  return request(`${UMS_REQUEST_PREFIX}/crm/customer/staffsList`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 修改下单手机
 * @returns 
 */
export async function updateStaffs(params: companyTypes) {
  return request(`${UMS_REQUEST_PREFIX}/crm/customer/updateStaffs`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 认证审核
 * @returns 
 */
export async function customerCertifyCheck(params: companyTypes) {
  return request(`${UMS_REQUEST_PREFIX}/crm/customer/check`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 获取客户tab num
 * @returns 
 */
export async function fetchCompanyTabNum(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/crm/customer/tabNum`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}

// 线索列表
/**
 * 获取线索tab num
 * @returns 
 */
export async function fetchClueTabNum() {
  return request(`${UMS_REQUEST_PREFIX}/crm/clues/tabNum`, {
    method: 'POST',
    dataField: 'data'
  });
}
/**
 * 领取线索客户
 * @param params 
 * @returns 
 */
export async function receiveClueCompany(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/crm/clues/claim`, {
    method: 'POST',
    data: params
  });
}
/**
 * 根据手机号查询线索
 * @param params 
 * @returns 
 */
export async function selectByMobile(params: {mobile: string}) {
  return request(`${UMS_REQUEST_PREFIX}/crm/clues/selectByMobile`, {
    method: 'POST',
    data: params
  });
}
/**
 * 添加备注
 * @param params 
 * @returns 
 */
export async function addClueCustomerTag(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/crm/clues/tag`, {
    method: 'POST',
    data: params
  });
}
/**
 * 获取线索列表
 * @returns 
 */
export async function fetchClueList(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/crm/clues/list`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 批量导入线索
 * @returns 
 */
export async function importClueList(params: companyTypes) {
  return request(`${UMS_REQUEST_PREFIX}/crm/clues/importClues`, {
    method: 'POST',
    data: params
  });
}